package com.yixun.qfbao.config.ws;

import org.springframework.context.annotation.Bean;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;

//@Configuration
//@EnableWebSocket
public class ChannelWebSocketConfig implements WebSocketConfigurer {
    @Override
    public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
        registry.addHandler(channelWebSocketHandler(), "/websocket/channel").setAllowedOrigins("*").addInterceptors(new ChannelWebSocketHandshakeInterceptor());
    }
    @Bean
    public ChannelWebSocketHandler channelWebSocketHandler(){
        return new ChannelWebSocketHandler();
    }
}
